<template>
	<view>
		<cu-custom bgColor="bg-blue" :isBack="true">
			<block slot="content">学生管理</block>
		</cu-custom>
		<view class="management">
			<view class="managementList" v-for="(item,index) in list" :key="index" @tap="to_schoolList(item.job_id)">
				<block>
					<image :src="item.logo" v-if="item.logo!=null"></image>
					<view class="logo_box" v-if="item.logo==null">{{item.job_name[0]}}</view>
				</block>
				<view class="listWord">
					<view class="boldWord">{{item.job_name}}</view>
					<view class="grayWord">{{item.describe}}</view>
				</view>
				<view class="iconRight">
					<text class="cuIcon-right rigpic text-gray"></text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const {appLogin,httpGet,httpPost} = require("@/utils/common.js")

	export default {
		data() {
			return {
				list:[],
				status:1,
				page:'1',
				page_size:'20'
			}
		},
		onLoad() {
			appLogin((user_info) => {
				console.log(user_info)
			})
		},
		onShow(){
			this.page = 1;
			this.list = [];
			// 清空列表
			this.getPostList()
			// 回到页面展示
		},
		onReachBottom(){   // 页面滚动到底部
			this.page++
			this.getPostList()
		},
		methods: {
			getPostList(){
				httpGet({
					url:'/api/company/job_list',
					data:{
						page:this.page,
						page_size:this.page_size
					}
				}).then(res => {
					console.log(res)
					this.list = this.list.concat(res.result.list)
					// 把两个列表加一起
				})
			},
			to_schoolList(job_id){
				uni.navigateTo({
					url:'student_list?job_id='+job_id
				})
			}
		}
	}
</script>

<style>
	.managementList{
		width: 100%;
		height: 165rpx;
		background-color: #FFFFFF;
		display: flex;
		padding-top: 25rpx;
		border-bottom: solid 2px #E7EBED;
	}
	.boldWord{
		color: black;
		font-size: 35rpx;
		margin-top: 10rpx;
	}
	.grayWord{
		color: #AAAAAA;
		font-size: 30rpx;
		margin-top: 5rpx;
		width: 520rpx;
		height: 40rpx;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.iconRight{
		float: right;
		font-size: 30rpx;
		margin-top: 45rpx;
	}
	.listWord{
		width: 530rpx;
	}
	.addItem{
		border-bottom: solid 2px #E7EBED;
		padding-top: 30rpx;
	}
	.frame{
		border:2px dashed #3b73f6;
		width: 65rpx;
		height: 65rpx;
		border-radius: 10rpx;
		color: blue;
		margin: 0rpx 40rpx 40rpx 30rpx;
		padding: 10rpx 10rpx 10rpx 10rpx;
	}
	
	
	.logo_box{
		width: 105rpx;
		height: 105rpx;
		border-radius: 20rpx;
		margin: 0rpx 30rpx 25rpx 30rpx;
		background-color: #FFF6EC;
		line-height: 105rpx;
		font-size: 40rpx;
		text-align: center;
	}
</style>
